package com.shop.service.impl;

import com.shop.mapper.AddressMapper;
import com.shop.model.Address;
import com.shop.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author 何鸿鹰
 * date 2025/5/14 22:47
 * ClassName com.shop.service.impl
 *
 * @version 1.0
 */
@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    AddressMapper addressMapper;


    @Override
    public List<Address> selectByUserId(Integer userId) {
        return addressMapper.selectByUserId(userId);
    }


    @Override
    public Address getAddressById(Integer id) {
        return addressMapper.selectById(id);
    }

    @Override
    public void addAddress(Address address) {
        addressMapper.insert(address);
    }

    @Override
    public void updateAddress(Address address) {
        addressMapper.update(address);
    }

    @Override
    public void deleteAddress(Integer id) {
        addressMapper.deleteById(id);
    }
}
